package com.tulele.vtool.service.impl;

import com.tulele.vtool.mapper.BArticleIllustrateMapper;
import com.tulele.vtool.model.BArticleIllustrate;
import com.tulele.vtool.service.BArticleIllustrateService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 文章插入图片表(BArticleIllustrate)表服务实现类
 *
 * @author makejava
 * @since 2020-09-29 09:22:06
 */
@Service
public class BArticleIllustrateServiceImpl implements BArticleIllustrateService {
    @Resource
    private BArticleIllustrateMapper bArticleIllustrateMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public BArticleIllustrate queryById(Integer id) {
        return this.bArticleIllustrateMapper.queryById(id);
    }

    /**
     * 通过实例对象查询单条数据
     *
     * @param bArticleIllustrate 实例对象
     * @return 实例对象
     */
    @Override
    public BArticleIllustrate queryByEntity(BArticleIllustrate bArticleIllustrate) {
        return this.bArticleIllustrateMapper.queryByEntity(bArticleIllustrate);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<BArticleIllustrate> queryAllByLimit(int offset, int limit) {
        return this.bArticleIllustrateMapper.queryAllByLimit(offset, limit);
    }

    /**
     * 通过实体作为筛选条件查询
     *
     * @param bArticleIllustrate 实例对象
     * @return 对象列表
     */
    @Override
    public List<BArticleIllustrate> queryAll(BArticleIllustrate bArticleIllustrate) {
        return this.bArticleIllustrateMapper.queryAll(bArticleIllustrate);
    }

    /**
     * 新增数据
     *
     * @param bArticleIllustrate 实例对象
     * @return 实例对象
     */
    @Override
    public BArticleIllustrate insert(BArticleIllustrate bArticleIllustrate) {
        this.bArticleIllustrateMapper.insert(bArticleIllustrate);
        return bArticleIllustrate;
    }

    /**
     * 修改数据
     *
     * @param bArticleIllustrate 实例对象
     * @return 实例对象
     */
    @Override
    public BArticleIllustrate update(BArticleIllustrate bArticleIllustrate) {
        this.bArticleIllustrateMapper.update(bArticleIllustrate);
        return this.queryById(bArticleIllustrate.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.bArticleIllustrateMapper.deleteById(id) > 0;
    }
}
